package net.hands.common.logger;

import java.util.logging.Level;

/**
 * 说明:jdk日志
 * <br>
 * <p>这是一个开源的软件，请在LGPLv3下合法使用、修改或重新发布。</p>
 * @author 陈侃(cknet@126.com, 13910090885)
 *         http://code.google.com/p/simpleframework/
 *         http://www.simpleframework.net
 */
public class JdkLog extends LogImpl {
	/**
	 * 日志
	 */
	private final java.util.logging.Logger _log;
	/**
	 * 
	 * Constructor Method  
	 * @update 2012-9-20 下午5:19:30  
	 * @param name
	 */
	public JdkLog(final String name) {
		_log = java.util.logging.Logger.getLogger(name);
	}
	/**
	 * 
  (non-Javadoc)  
	 * @see net.hands.common.logger.Log#debug(java.lang.String, java.lang.Object[])  
	 * @update 2012-9-20 下午5:19:59
	 */
	@Override
	public void debug(final String message, final Object... args) {
		_log.log(Level.FINE, format(message, args));
	}
	/**
	 * 
(non-Javadoc)  
	 * @see net.hands.common.logger.Log#debug(java.lang.Throwable, java.lang.String, java.lang.Object[])  
	 * @update 2012-9-20 下午5:20:05
	 */
	@Override
	public void debug(final Throwable e, final String message, final Object... args) {
		_log.log(Level.FINE, format(message, args), e);
	}
	/**
	 * 
(non-Javadoc)  
	 * @see net.hands.common.logger.Log#trace(java.lang.String, java.lang.Object[])  
	 * @update 2012-9-20 下午5:20:09
	 */
	@Override
	public void trace(final String message, final Object... args) {
		_log.log(Level.FINER, format(message, args));
	}
	/**
	 * 
(non-Javadoc)  
	 * @see net.hands.common.logger.Log#trace(java.lang.Throwable, java.lang.String, java.lang.Object[])  
	 * @update 2012-9-20 下午5:20:14
	 */
	@Override
	public void trace(final Throwable e, final String message, final Object... args) {
		_log.log(Level.FINER, format(message, args), e);
	}
	/**
	 * 
(non-Javadoc)  
	 * @see net.hands.common.logger.Log#info(java.lang.String, java.lang.Object[])  
	 * @update 2012-9-20 下午5:20:21
	 */
	@Override
	public void info(final String message, final Object... args) {
		_log.log(Level.INFO, format(message, args));
	}
	/**
	 * 
(non-Javadoc)  
	 * @see net.hands.common.logger.Log#info(java.lang.Throwable, java.lang.String, java.lang.Object[])  
	 * @update 2012-9-20 下午5:20:24
	 */
	@Override
	public void info(final Throwable e, final String message, final Object... args) {
		_log.log(Level.INFO, format(message, args), e);
	}
	/**
	 * 
(non-Javadoc)  
	 * @see net.hands.common.logger.Log#warn(java.lang.String, java.lang.Object[])  
	 * @update 2012-9-20 下午5:20:30
	 */
	@Override
	public void warn(final String message, final Object... args) {
		_log.log(Level.WARNING, format(message, args));
	}
	/**
	 * 
(non-Javadoc)  
	 * @see net.hands.common.logger.Log#warn(java.lang.Throwable, java.lang.String, java.lang.Object[])  
	 * @update 2012-9-20 下午5:20:34
	 */
	@Override
	public void warn(final Throwable e, final String message, final Object... args) {
		_log.log(Level.WARNING, format(message, args), e);
	}
	/**
	 * 
(non-Javadoc)  
	 * @see net.hands.common.logger.Log#error(java.lang.String, java.lang.Object[])  
	 * @update 2012-9-20 下午5:20:39
	 */
	@Override
	public void error(final String message, final Object... args) {
		_log.log(Level.SEVERE, format(message, args));
	}
	/**
	 * 
(non-Javadoc)  
	 * @see net.hands.common.logger.Log#error(java.lang.Throwable, java.lang.String, java.lang.Object[])  
	 * @update 2012-9-20 下午5:20:43
	 */
	@Override
	public void error(final Throwable e, final String message, final Object... args) {
		_log.log(Level.SEVERE, format(message, args), e);
	}
}
